//
//  ClassroomInquire.m
//  SchoolTask
//
//  Created by tusm on 16/8/26.
//  Copyright © 2016年 sm. All rights reserved.
//

#import "ClassroomInquire.h"
#define kScreenW [UIScreen mainScreen].bounds.size.width
#define kScreenH [UIScreen mainScreen].bounds.size.height


@interface ClassroomInquire ()

@property (nonatomic,retain) UIView  *btView;           //承载所有按钮
@property (nonatomic,retain) UILabel *timeLb;           //时间
@property (nonatomic,retain) UILabel *teachingBuilding; //教训楼
@property (nonatomic,retain) UILabel *fool;             //楼层

@property (nonatomic,retain) UIView  *timeView;         //承载时间label
@property (nonatomic,retain) NSMutableArray *timeMArray;
@end

@implementation ClassroomInquire

- (instancetype)init
{
    self = [super init];
    if (self) {
        
        self.frame = [UIScreen mainScreen].bounds;
        self.backgroundColor = [UIColor whiteColor];
        [self setbtViewController];
        [self settimeViewAndController];
    }
    return self;
}

- (void)settimeViewAndController {
    
    //    414 320  736 480
    CGFloat w = 414 / kScreenW;
    CGFloat h = 736 / kScreenH;
    CGFloat wc = kScreenW / 8;
    _timeView   = [[UIView alloc]initWithFrame:CGRectMake(0, 150/h, kScreenW, 50/h)];
    _timeView.backgroundColor = [UIColor whiteColor];
    
    _timeMArray = [NSMutableArray arrayWithObjects:@"教室",@"08:00",@"10:00",@"14:00",@"16:00",@"19:00",@"21:00",@"jiio",nil];
    
    for (NSInteger i = 0; i < _timeMArray.count; i++) {
        
        UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(wc * i, 0, wc, 50/h)];
        label.text = _timeMArray[i];
        label.textColor = [UIColor colorWithRed:120/255.0 green:120/255.0 blue:120/255.0 alpha:1];

        [_timeView addSubview:label];
        label.layer.shouldRasterize = YES;
        label.layer.borderColor = [[UIColor colorWithRed:230/255.0 green:240/255.0 blue:250/255.0 alpha:1] CGColor];
        label.layer.borderWidth = 1;

    }
    _timeView.backgroundColor = [UIColor colorWithRed:235/255.0 green:235/255.0 blue:235/255.0 alpha:1];

    [self addSubview:_timeView];
}

- (void)setbtViewController {
    
    CGFloat wc = kScreenW / 3 ;
    //    414 320  736 480
    CGFloat w = 414 / kScreenW;
    CGFloat h = 736 / kScreenH;
    _btView   = [[UIView alloc]initWithFrame:CGRectMake(0, 84/h, kScreenW, 50/h)];
    _timeLb   = [[UILabel alloc]initWithFrame:CGRectMake(0, 10/h, 80/w, 30/h)];
    _fool     = [[UILabel alloc]initWithFrame:CGRectMake(290/w, 10/h, 70/w, 30/h)];
    _teachingBuilding = [[UILabel alloc]initWithFrame:CGRectMake(130/w, 10/h, 80/w, 30/h)];
    _btView.backgroundColor = [UIColor colorWithRed:230/255.0 green:230/255.0 blue:230/255.0 alpha:1];


    _timeLb.text = @"2016.08.22";
    _fool.text   = @"三层";
    _teachingBuilding.text = @"逸夫综合楼";
    
    _timeLb.textAlignment = 2;
    _fool.textAlignment   = 2;
    _teachingBuilding.textAlignment = 2;
    
    _timeLb.font = [UIFont systemFontOfSize:13/w];
    _fool.font   = [UIFont systemFontOfSize:13/w];
    _teachingBuilding.font = [UIFont systemFontOfSize:13/w];
    
    _timeLb.textColor = [UIColor colorWithRed:80/255.0 green:80/255.0 blue:80/255.0 alpha:1];
    _fool.textColor   = [UIColor colorWithRed:80/255.0 green:80/255.0 blue:80/255.0 alpha:1];
    _teachingBuilding.textColor = [UIColor colorWithRed:80/255.0 green:80/255.0 blue:80/255.0 alpha:1];
    
    for (NSInteger i = 0; i < 3; i++) {
        
        UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
        button.frame     = CGRectMake(wc * (i+1) - 50/w, 10/h, 30/w, 30/h);
        button.tag       = 1000 + i;
        [button setBackgroundImage:[UIImage imageNamed:@"下拉按钮图标"] forState:UIControlStateNormal];
        [_btView addSubview:button];
    }
    
    [self addSubview:_btView];
    [_btView addSubview:_timeLb];
    [_btView addSubview:_fool];
    [_btView addSubview:_teachingBuilding];
}

@end
